<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div class="box">111</div>
    <script>
        const box = document.querySelector('.box')
        let flag = true//节流阀门可以阻止计算器再次点击加速
        let n = 6
        box.addEventListener('click', function () {
            if (flag) {
                flag = false
                const time = setInterval(function () {
                    box.innerHTML = `${n}秒`
                    n--
                    if (n === 0) {
                        flag = true
                        clearInterval(time)
                        n = 6
                    }
                }, 1000)
            }
        })
    </script>
</body>

</html>